﻿@{
    ViewBag.Title = "播放列表";
}
@section headerSection{
    <style>
        #exampleToolbar > .form-group {
            float: left;
            margin: 0;
            margin-left: 5px;
        }
    </style>
}
<div class="animated fadeInRight">
    <!-- Panel Other -->
    <div class="ibox float-e-margins" style="margin-bottom: 0px;">
        <div class="ibox-content" style="padding: 5px 20px 0px 20px;">
            <div class="row row-lg">
                <div class="col-sm-12 col-sm-leftRight">
                    <!-- Example Toolbar -->
                    <div class="example">
                        <div class="btn-group hidden-xs" id="exampleToolbar" role="group">
                            <div class="form-group" style="margin-left:0;width:200px;">
                                <input id="userName" name="userName" type="text" class="form-control" placeholder="订单号/商品名/购买人">
                            </div>
                            <div class="form-group" style="width:150px;margin-top:-4px;">
                                <select id="playStatus" class="form-control input-sm selectpicker" placeholder="请选择播放状态" style="padding: 5px 10px;">
                                    <option value="-1" selected>全部</option>
                                    <option value="0">待播放</option>
                                    <option value="1">已播放</option>
                                </select>
                            </div>
                            <div class="form-group">
                                <button id="btnSearch" class="btn btn-primary" type="button"><i class="fa fa-search"></i>&nbsp;查询</button>
                            </div>
                        </div>
                        <table id="exampleTableToolbar" data-mobile-responsive="true" data-radio="true"></table>
                    </div>
                    <!-- End Example Toolbar -->
                </div>
            </div>
        </div>
    </div>
    <!-- End Panel Other -->
</div>
@section footSection{
    <script>
        var $table, options;
        var playManager = {
            //1.0 初始化页面
            initPage: function () {
                parent.showLoadBoxs();
                playManager.initTable();
                playManager.bindEvent();
                parent.delLoadBoxs();
            },
            //1.1 初始化Table
            initTable: function () {
                options = {
                    url: ctx + "/VRCircle/InitPlayTable",
                    cutHeight: 5,
                    showRefresh: false,
                    showToggle: false,
                    showColumns: false,
                    toolbar: "#exampleToolbar",
                    queryParams: function (params) {
                        params = {
                            rows: params.limit,
                            //页面大小  
                            page: params.offset / params.limit + 1,
                            userName: ($('#userName').val()) ? encodeURI($('#userName').val()) : "",//用户名、登录名
                            playStatus: $('#playStatus').val()
                        }
                        return params;
                    },
                    columns: [
                    {
                        radio: true
                    }, {
                        field: '',//第一列序号
                        title: '序号',
                        align: 'center',
                        width: 50,
                        formatter: function (value, row, index) {
                            return index + 1;
                        }
                    },
                    {
                        field: 'OrderCode',
                        title: '订单号',
                        align: 'center'
                    },
                    {
                        field: 'PlayStatus',
                        title: '点播状态',
                        align: 'center',
                        formatter: function (value, row, index) {
                            return (value && value>0)?"已播放":"待播放";
                        }
                    },
                    {
                        field: 'UserName',
                        title: '点播人',
                        align: 'center'
                    }, {
                        field: 'Content',
                        title: '内容',
                        align: 'center',
                        formatter: function (value, row, index) {
                            if (value && value.length > 20)
                                return value.substring(0, 20) + '...';
                            return value;
                        }
                    },
                    {
                        field: 'picCount',
                        title: '图片数量',
                        align: 'center'
                    }, {
                        field: 'CommodityName',
                        title: '商品名称',
                        align: 'center'
                     }, {
                        field: 'VideoUrl',
                        title: '模板视频',
                        align: 'center'
                    }, {
                        field: 'StoreName',
                        title: '店铺名称',
                        align: 'center'
                    }, {
                        field: 'UpdateDate',
                        title: '更新时间',
                        align: 'center'
                    }, {
                        field: 'CreateDate',
                        title: '创建时间',
                        align: 'center'
                    }],
                    onClickRow: function (row, $element) {
                    }
                }
                $table = tableHelper.initTable("exampleTableToolbar", options);
            },
            //绑定默认事件
            bindEvent: function () {
                //查询
                $('#btnSearch').click(function () {
                    $table.bootstrapTable('refresh', options);
                });
            }
        }
        $(function () {
            playManager.initPage();
        });
    </script>
}